Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
is-plain-obj
Advanced tools
The is-plain-obj package is a simple and lightweight npm package used to check if a given object is a plain object, that is, an object created by the Object constructor or one with a null prototype.
Check if an object is a plain object
This feature allows you to verify if a given object is a plain object. It returns true for objects created by the Object constructor or with a null prototype and false for all other types of objects, such as instances of custom classes or built-in JavaScript objects like Map.
const isPlainObj = require('is-plain-obj');
console.log(isPlainObj({foo: 'bar'})); // true
console.log(isPlainObj(new Map())); // false
Similar to is-plain-obj, is-plain-object checks if a given value is a plain object. However, it might have slightly different internal implementations or dependencies, potentially affecting its performance or compatibility in certain environments.
Part of the Lodash library, lodash.isplainobject offers similar functionality to is-plain-obj. Lodash is a more extensive utility library, so using this function might bring in more dependencies than needed if you're only interested in checking for plain objects.
Check if a value is a plain object
An object is plain if it's created by either {}
, new Object()
, or Object.create(null)
.
$ npm install is-plain-obj
const isPlainObject = require('is-plain-obj');
isPlainObject({foo: 'bar'});
//=> true
isPlainObject(new Object());
//=> true
isPlainObject(Object.create(null));
//=> true
isPlainObject([1, 2, 3]);
//=> false
class Unicorn {}
isPlainObject(new Unicorn());
//=> false
FAQs
Check if a value is a plain object
The npm package is-plain-obj receives a total of 33,899,319 weekly downloads. As such, is-plain-obj popularity was classified as popular.
We found that is-plain-obj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.